package com.teemor.blog.controller;

import com.teemor.blog.api.IModifyhisApiService;
import com.teemor.blog.bean.condition.TbModifyhisCondition;
import com.teemor.blog.bean.dto.input.modifyhis.AddModifyhisIPo;
import com.teemor.blog.bean.dto.input.modifyhis.QryModifyhissIPo;
import com.teemor.blog.bean.dto.input.modifyhis.UpdModifyhisIPo;
import com.teemor.blog.bean.dto.output.modifyhis.QryModifyhisOPo;
import com.teemor.blog.bean.dto.output.modifyhis.QryModifyhissOPo;
import com.teemor.blog.bean.entity.TbModifyhis;
import com.teemor.blog.service.IModifyhisService;
import java.util.List;

import com.teemor.common.bean.utils.BeanConvertor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhoulk
 * @Description: 原子服务API接口实现
 * @date: 2020/03/24 17:33:32
 */
@RestController
public class ModifyhisController implements IModifyhisApiService {
    @Autowired
    private IModifyhisService iModifyhisService;

    @Override
    public QryModifyhisOPo qryModifyhis(@PathVariable Integer id) {
        return BeanConvertor.convertBean(iModifyhisService.qryModifyhisById(id), QryModifyhisOPo.class);
    }

    @Override
    public int countModifyhis(@RequestBody QryModifyhissIPo inParam) {
        TbModifyhisCondition condition = BeanConvertor.convertBean(inParam, TbModifyhisCondition.class);
        return iModifyhisService.countModifyhis(condition);
    }

    @Override
    public List<QryModifyhissOPo> qryModifyhiss(@RequestBody QryModifyhissIPo inParam) {
        TbModifyhisCondition condition = BeanConvertor.convertBean(inParam, TbModifyhisCondition.class);
        return BeanConvertor.convertBeanList(iModifyhisService.qryModifyhiss(condition), QryModifyhissOPo.class);
    }

    @Override
    public void updModifyhis(@RequestBody UpdModifyhisIPo inParam) {
        TbModifyhis tbModifyhis = BeanConvertor.convertBean(inParam, TbModifyhis.class);
        iModifyhisService.updModifyhisById(tbModifyhis);
    }

    @Override
    public void addModifyhis(@RequestBody AddModifyhisIPo inParam) {
        TbModifyhis tbModifyhis = BeanConvertor.convertBean(inParam, TbModifyhis.class);
        iModifyhisService.addModifyhis(tbModifyhis);
    }
}